package cn.edu.scau.cmi.chenruilin.hibernate;

import org.springframework.context.ApplicationContext;


import javafx.fxml.FXML;
import javafx.scene.control.Label;

public class SingletonApplicationContextController {
	@FXML
    private Label output;
	private static Student student;

	public static ApplicationContext getApplicationContextUtil() {
		ApplicationContext ac = ApplicationContextUtil.getApplicationContext();
		return ac;
	}
	@FXML
    void initialize() {
		ApplicationContext ac = getApplicationContextUtil();
		student = (Student)ac.getBean("zhangsan");
		String s = "学生姓名： " + student.getName() + "    导师姓名： " + student.getTeacher().getName();
		output.setText(s);
    }
}
